import { getFavorList, getHistoryList } from "@/services/modules/favor";
import { defineStore } from "pinia";

const useFavorStore = defineStore("favor", {
    state: () => ({
        favorList: [],
        historyList: []
    }),
    actions: {
        // 拿到收藏数据
        async fetchFavorListData() {
            const res = await getFavorList()
            this.favorList = res?.data?.data?.items || []
        },
        // 历史数据
        async fetchHistoryListData() {
            const res = await getHistoryList()
            this.historyList = res?.data?.data?.items || []
        }
    }
})

export default useFavorStore